import java.util.Random;
import java.util.Scanner;

public class Test {
    public static int sum (int n) {
        if (n == 0) {
            return 0;

        }

        
        return n + sum(n - 1);
    }

    public static void main(String[] args) {
        System.out.println(sum(10));
    }

    public static void main3(String[] args) {
        Random random = new Random();
        int randNum = random.nextInt(100);
        System.out.println(randNum);
        Scanner scan = new Scanner(System.in);
        while (true) {
            System.out.println("请输入你要猜的数字");
            int num = scan.nextInt();
            if (num < randNum) {
                System.out.println("小了");
            } else if (num == randNum) {
                System.out.println("等于");
                break;
            } else {
                System.out.println("大了");

            }
        }
    }


    public static void main2(String[] args) {
        double sum = 0;
        int flg = 1;
        for (int i = 1; i <= 100; i++) {
            sum = sum + 1.0 / i * flg;
            flg = -flg;

        }
        System.out.println(sum);
    }

    public static void main1(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            if (i % 10 == 9) {
                count++;
            }
            if (i / 10 == 9) {
                count++;
            }
        }
        System.out.println(count);
    }
}
